<script lang="ts">
import { defineComponent } from "vue";

export default defineComponent({
  props: {
    info: { type: Object, required: true },
  },
});
</script>

<template>
  <view class="course-item">
    <image class="course-item-img" :src="info.pic" lazy-load />
    <view class="course-item-content">
      <view class="course-item-name">{{ info.title }}</view>
      <view style="display: flex; align-items: center">
        <view class="course-item-tag" v-for="i of info.tag_arr" :key="i">
          {{ i }}
        </view>
      </view>
    </view>
  </view>
</template>

<style lang="scss">
.course-item {
  display: flex;
  align-items: flex-start;

  .course-item-img {
    flex-shrink: 0;
    width: 120rpx;
    height: 120rpx;
    border-radius: 20rpx;
  }

  .course-item-content {
    flex-grow: 1;
    min-width: 0;
    margin-left: 20rpx;
  }

  .course-item-name {
    margin-bottom: 12rpx;
    font-size: 28rpx;
    color: #333333;
    line-height: 40rpx;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }

  .course-item-tag {
    padding: 0 8rpx;
    margin-right: 10rpx;
    font-size: 24rpx;
    color: #4e9b93;
    line-height: 36rpx;
    border-radius: 10rpx;
    border: 2rpx solid rgba(78, 155, 147, 0.2);
  }
}
</style>